package org.studle.domain;

import java.util.Date;

public class ScheduleEntry {
	final static String KEY_PREFFIX = "schentry";
	private static int keyNumber = 0;
	
	private Date startDate;
	private Event event;
	private boolean isActive;
	private String id;
	
	public ScheduleEntry(Event event, Date startDate) {
		this.startDate = startDate;
		this.event = event;
		this.isActive = true;
		this.id = (KEY_PREFFIX + keyNumber++);
	}

	public Date getStartDate() {
		return startDate;
	}
	
	public Event getEvent(){
		return event;
	}
	
	public void cancelEntry() throws IllegalStateException{
		if (this.isActive == true ) throw new IllegalStateException ("Schedule Entry is already canceled");
		this.isActive = false;
	}

	public String getID() {
		return id;
	}

}
